package com.news.reader;

import java.util.ArrayList;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class NewsReader extends ListActivity  {
	public static final String TAG = "NewsReader";
	
	ArrayList<String> newsgroupList = new ArrayList<String>();
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	Log.v(TAG, "Activity State: onCreate()");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        newsgroupList.add("news.newsgroup.la");
        newsgroupList.add("news.3home.net");
        setListAdapter(new ArrayAdapter<String>(this, R.layout.row, R.id.label, newsgroupList));
    }
    
    public void onListItemClick(ListView parent, View v, int position, long id) {
    	launchGroupList(newsgroupList.get(position));
    }
    
    protected void launchGroupList(String newsgroup) {
        Intent i = new Intent(this, GroupList.class);
        //i.putExtra("newsgroup", newsgroup);
        i.putExtra("newsgroup", "10.11.202.250");
		startActivity(i);
    }
}